package com.telcordia.cvas.rpn;

import static junit.framework.Assert.assertEquals;

import org.junit.Test;

public class PrimeFactorsTest {
	
	private int value;
	private OperandStack stack;

	@Test
	public void primeFactorOf2Is2() {
		givenOperand(2);
		whenCalculatingPrimeFactors();
		thenTheResultShouldInclude(2);
	}

	private void thenTheResultShouldInclude(int expected) {
		assertEquals(expected, stack.pop());
	}

	private void whenCalculatingPrimeFactors() {
		stack = new OperandStack();
		stack.push(value);
		new PrimeFactors().execute(stack);
	}

	private void givenOperand(int value) {
		this.value = value;
	}

}
